﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function(){
	$(".menu > li").click(function(e){
		switch(e.target.id){
			case "news":
				//change status & style menu
				$("#news").addClass("active");
				$("#categories").removeClass("active");
				$("#users").removeClass("active");
				$("#products").removeClass("active");
				$("#suppliers").removeClass("active");
				$("#orders").removeClass("active");
				//display selected division, hide others
				$("div.news").fadeIn();
				$("div.categories").css("display", "none");
				$("div.users").css("display", "none");
				$("div.products").css("display", "none");
				$("div.suppliers").css("display", "none");
				$("div.orders").css("display", "none");
			break;
			case "categories":
				//change status & style menu
				$("#news").removeClass("active");
				$("#categories").addClass("active");
				$("#users").removeClass("active");
				$("#products").removeClass("active");
				$("#suppliers").removeClass("active");
				$("#orders").removeClass("active");
				//display selected division, hide others
				$("div.categories").fadeIn();
				$("div.news").css("display", "none");
				$("div.users").css("display", "none");
				$("div.products").css("display", "none");
				$("div.suppliers").css("display", "none");
				$("div.orders").css("display", "none");
			break;
			case "users":
				//change status & style menu
				$("#news").removeClass("active");
				$("#categories").removeClass("active");
				$("#users").addClass("active");
				$("#products").removeClass("active");
				$("#suppliers").removeClass("active");
				$("#orders").removeClass("active");
				//display selected division, hide others
				$("div.users").fadeIn();
				$("div.news").css("display", "none");
				$("div.categories").css("display", "none");
				$("div.products").css("display", "none");
				$("div.suppliers").css("display", "none");
				$("div.orders").css("display", "none");
			break;
			case "products":
				//change status & style menu
				$("#categories").removeClass("active");
				$("#users").removeClass("active");
				$("#news").removeClass("active");
				$("#products").addClass("active");
				$("#suppliers").removeClass("active");
				$("#orders").removeClass("active");
				//display selected division, hide others
				$("div.news").css("display", "none");
				$("div.categories").css("display", "none");
				$("div.users").css("display", "none");
				$("div.products").fadeIn();
				$("div.suppliers").css("display", "none");
				$("div.orders").css("display", "none");
			break;
			case "suppliers":
				//change status & style menu
				$("#categories").removeClass("active");
				$("#users").removeClass("active");
				$("#news").removeClass("active");
				$("#products").removeClass("active");
				$("#suppliers").addClass("active");
				$("#orders").removeClass("active");
				//display selected division, hide others
				$("div.news").css("display", "none");
				$("div.categories").css("display", "none");
				$("div.users").css("display", "none");
				$("div.products").css("display", "none");
				$("div.suppliers").fadeIn();
				$("div.orders").css("display", "none");
			break;
			case "orders":
				//change status & style menu
				$("#news").removeClass("active");
				$("#categories").removeClass("active");
				$("#users").removeClass("active");
				$("#products").removeClass("active");
				$("#suppliers").removeClass("active");
				$("#orders").addClass("active");
				//display selected division, hide others
				$("div.news").css("display", "none");
				$("div.categories").css("display", "none");
				$("div.users").css("display", "none");
				$("div.products").css("display", "none");
				$("div.suppliers").css("display", "none");
				$("div.orders").fadeIn();
			break;	
		}
		//alert(e.target.id);
		return false;
	});
});